/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ar.edu.utn.frsf.cidisi.upcolbpip.collaborativebusinessprocesses.impl;

import ar.edu.utn.frsf.cidisi.upcolbpip.collaborativebusinessprocesses.*;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class CollaborativebusinessprocessesFactoryImpl extends EFactoryImpl implements CollaborativebusinessprocessesFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static CollaborativebusinessprocessesFactory init() {
		try {
			CollaborativebusinessprocessesFactory theCollaborativebusinessprocessesFactory = (CollaborativebusinessprocessesFactory)EPackage.Registry.INSTANCE.getEFactory("ar.edu.utn.frsf.cidisi.upcolbpip.collaborativebusinessprocesses"); 
			if (theCollaborativebusinessprocessesFactory != null) {
				return theCollaborativebusinessprocessesFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new CollaborativebusinessprocessesFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CollaborativebusinessprocessesFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case CollaborativebusinessprocessesPackage.COLLABORATIVE_BUSINESS_PROCESS: return createCollaborativeBusinessProcess();
			case CollaborativebusinessprocessesPackage.EXCEPTION_POINT: return createExceptionPoint();
			case CollaborativebusinessprocessesPackage.EXCEPTION_PROCESS: return createExceptionProcess();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case CollaborativebusinessprocessesPackage.PROCESS_STATES:
				return createProcessStatesFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case CollaborativebusinessprocessesPackage.PROCESS_STATES:
				return convertProcessStatesToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CollaborativeBusinessProcess createCollaborativeBusinessProcess() {
		CollaborativeBusinessProcessImpl collaborativeBusinessProcess = new CollaborativeBusinessProcessImpl();
		return collaborativeBusinessProcess;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ExceptionPoint createExceptionPoint() {
		ExceptionPointImpl exceptionPoint = new ExceptionPointImpl();
		return exceptionPoint;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ExceptionProcess createExceptionProcess() {
		ExceptionProcessImpl exceptionProcess = new ExceptionProcessImpl();
		return exceptionProcess;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ProcessStates createProcessStatesFromString(EDataType eDataType, String initialValue) {
		ProcessStates result = ProcessStates.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertProcessStatesToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CollaborativebusinessprocessesPackage getCollaborativebusinessprocessesPackage() {
		return (CollaborativebusinessprocessesPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static CollaborativebusinessprocessesPackage getPackage() {
		return CollaborativebusinessprocessesPackage.eINSTANCE;
	}

} //CollaborativebusinessprocessesFactoryImpl
